<template>
	<view class="">
		<view class="coupon text-grey shadow box11" v-for="(item,index) in coupon.rows">
			<view class="coupon_left">
				<view class="coupon_left_top">
					{{item.couponName}}
				</view>
				<view class="coupon_left_buttom">

				</view>
			</view>
			<view class="coupon_right">
				<view class="coupon_right_top">
					<view class="coupon_right_top_left">
						{{item.couponState}}
					</view>
					<view class="coupon_right_top_right">

					</view>
				</view>
				<view class="">

				</view>
				<view class="coupon_right_buttom">
					<view class="">
						{{item.effectiveTime}}
					</view>
					<view class="coupon_right_buttom_button" @tap="Useitnow()">
						立即使用
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				coupon: null //优惠券
			}
		},
		onShow() {
			this.selectUserContro()
		},
		computed:{
			...mapState(['id'])
		},
		methods: {
			selectUserContro() {
				this.request.selectUserContro({
					id: this.id
				}).then(res => {
					this.coupon = res
				})
			},
			Useitnow() {
				uni.redirectTo({
					url: '../Order/orders'
				});
			}
		}
	}
</script>

<style lang="scss">
	.coupon {
		-webkit-box-shadow: 2px 2px 2px #3F536E;
		box-shadow: 1rpx 1rpx 7rpx #3F536E;
		padding: 10rpx 20rpx;
		display: -webkit-box;
		margin: 10rpx 20rpx;
		display: -webkit-flex;
		display: flex;
		border-radius: 13rpx;
		height: 190rpx;
		background-color: #FFFFFF;
	}

	.coupon_left {
		width: 178rpx;
		text-align: center;
		background-color: #39B54A;

		.coupon_left_top,
		.coupon_left_buttom {
			color: #FFFFFF;
			height: 50rpx;
			width: 178rpx;
			line-height: 150rpx;
		}

		.coupon_left_top {
			font-size: 30rpx;
			font-weight: 500;
		}

		.coupon_left_buttom {
			font-size: 24rpx;
		}
	}

	.coupon_right_buttom {
		margin-top: 60rpx;
	}

	.coupon_right {
		padding: 15rpx 10rpx;
		margin-left: 10rpx;
		width: 572rpx;
		line-height: 56rpx;
		font-size: 24rpx;

		.coupon_right_top,
		.coupon_right_buttom {
			display: flex;
			justify-content: space-between;
		}

		.coupon_right_top {
			.coupon_right_top_left {
				width: 150rpx;
				height: 40rpx;
				line-height: 32rpx;
				text-align: center;
				color: #FFFFFF;
				background-color: #f37b1d;
				padding: 5rpx;
				border-radius: 25rpx;
			}
		}

		.coupon_right_buttom {
			.coupon_right_buttom_button {
				width: 150rpx;
				height: 48rpx;
				line-height: 40rpx;
				text-align: center;
				color: #f37b1d;
				border: 1rpx solid #f37b1d;
				padding: 5rpx;
				border-radius: 25rpx;
			}
		}
	}

	.box11 {
		height: 100px;
		background: #FFFFFF;
		border-radius: 10px;
		margin: 10px;
	}

	.shadow {
		position: relative;
		box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.3),
			0px 0px 20px rgba(0, 0, 0, 0.1) inset;
	}

	.shadow::before,
	.shadow::after {
		content: "";
		position: absolute;
		z-index: -1;
	}

	.shadow::before,
	.shadow::after {
		content: "";
		position: absolute;
		z-index: -1;
		bottom: 15px;
		left: 10px;
		width: 50%;
		height: 20%;
	}

	.shadow::before,
	.shadow::after {
		content: "";
		position: absolute;
		z-index: -1;
		bottom: 15px;
		left: 10px;
		width: 50%;
		height: 20%;
		box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
		transform: rotate(-3deg);
	}

	.shadow::after {
		right: 10px;
		left: auto;
		transform: rotate(3deg);
	}
</style>
